package database.example.chapter26;

import java.sql.Connection;
import java.util.Scanner;

import database.example.common.ConnectionFactory;
import database.example.common.CloserUtil;
import database.example.dto.Department;
import database.example.dto.Employee;
import database.example.service.AbsService;
import database.example.service.DepartmentService;
import database.example.service.EmployeeService;

public class TestMain {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		Connection connection = ConnectionFactory.getConnection();
		boolean flag = true;
		
		while(flag){
			System.out.println("1. 부서  2. 사원  3. 종료");///
			switch (sc.nextInt()) {
				case 1:
					AbsService<Department> deptSvc = new DepartmentService(sc, connection);
					deptSvc.prnMenu();
					break;
				case 2:
					AbsService<Employee> empSvc = new EmployeeService(sc, connection);
					empSvc.prnMenu();
					break;
				default:
					CloserUtil.close(connection);
					flag=false;
				}
		}
	}
}
